<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="{$Think.const.index_tpl}/css/css.css" rel="stylesheet" type="text/css" /> 
        <script type="text/javascript" src="{$Think.const.index_tpl}/js/jquery.min.js"></script>
        <script type="text/javascript" src="{$Think.const.index_tpl}/js/jquery.SuperSlide.2.1.1.js"></script>
        <script src="{$Think.const.index_tpl}/js/layer.js"></script>
        <script src="{$Think.const.index_tpl}/js/ajaxfileupload.js"></script>
        <title>{:cfg('name')}注册</title>
    </head>
    <body class="bj_ff">
        <div class="dltop">
            <div class="nr">
                <a href="/" title=""><img src="{$Think.const.index_tpl}/images/logo.png" width="175" height="93" alt=""></a> 
            </div>
        </div>
        <div class="dlnr">
            <div class="dlfp">
                <div class="nr">
                    <div class="dlys slideTxtBox">
                        <div class="pf_dlli hd">
                            <ul>
                                <li class="on">密码修改</li>
                            </ul>
                        </div>
                        <div class="db_dlys bd">
                            <div class="nrb">
                                <div class="lib_dl">
                                    <div class="libnr">
                                        <div class="lf"><img src="{$Think.const.index_tpl}/images/li4.png" width="41" height="39" alt=""></div>
                                        <div class="rf">
                                            <input type="text" maxlength="11" name="phone" id="phone" pattern="[0-9]*" placeholder="请输入手机号" class="inputa">
                                        </div>
                                    </div>
                                </div>
                                <div class="lib_dl">
                                    <div class="libnr">
                                        <div class="lf"><img src="{$Think.const.index_tpl}/images/li3.jpg" width="41" height="39" alt=""></div>
                                        <div class="rfc"><input type="text" name="code" id="code" placeholder="请输入验证码"></div>
                                    </div>
                                    <div class="rfb"><a id="getcode" onclick="codes()" class="an_dl" style="height: 32px;display: block;padding-top: 7px;">获取验证码</a></div>
                                </div>
                                <div class="wjmm"><a href="/index/logins/forget/" title="">忘记密码？</a></div>
                                <div class="dl_an">
                                    <input type="submit" name="button" id="button" value="下一步" class="an_dl" onclick="ajax_post()">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="dl_dbwz">{:cfg('copyright')}</div>
        <script>
        
        function codes() {
            var phone = $("#phone").val();
            if (phone.length != 11) {
                layer.msg("手机号有误");
                return false;
            }
            var post = {};
            post.phone = phone;
            
            $.post("/index/logins/get_phonecode/", post, function (data)
            {
                if (data.status == 1)
                {
                    layer.msg(data.msg);
                    var now = new Date().getTime();
                    diftime(now);
                }
                else
                {
                    layer.msg(data.msg);
                }
            }, 'json');
        }

        
        function getdiftime(dateTimeStamp, minu) {
            var second = 1000;
            var now = new Date().getTime();
            var diffValue = now - dateTimeStamp;
            var seC = Math.floor(diffValue / second);
            if (seC <= minu * 60) {
                return 60 - seC + "s";
            } else {
                return -1;
            }
        }

        function diftime(times) {
            var dtime = getdiftime(times, 1);
            if (dtime != -1) {
                $("#getcode").html(dtime);
                $("#getcode").attr('data', 0);
                $("#getcode").attr("onclick","");
                TimeId = setTimeout("diftime(\'" + times + "\')", 1000);
            } else {
                $("#getcode").html('获取验证码');
                $("#getcode").attr('data', 1);
                $("#getcode").attr("onclick","codes()");
                clearTimeout(TimeId);
            }
        }

        function ajax_post()
        {
            var post = {};
            post.phone = $("#phone").val();
            post.code = $("#code").val();

            $.post("/index/logins/forget/", post, function (data)
            {
                if (data.status == 1)
                {
                    location.href = "/index/logins/forgettwo/phone/"+data.msg;
                }
                else
                {
                    layer.msg(data.msg);
                }
            }, 'json');
        }
        </script>